<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:78:"D:\www\photo_album_bless\public_html/../application/admin\view\album\edit.html";i:1546393808;s:68:"D:\www\photo_album_bless\application\admin\view\lib\common_list.html";i:1546393808;}*/ ?>
<!DOCTYPE html>
<html>


<!-- Mirrored from www.zi-han.net/theme/hplus/ by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:16:41 GMT -->
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp">
    <title></title>

    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->

    <link rel="stylesheet" href="/static/plugins/bootstrap-3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="/static/plugins/font-awesome-4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="/static/sys/css/style.min.css">
    <link rel="stylesheet" href="/static/plugins/bootstrap-table/bootstrap-table.css">
    <!--<link rel="stylesheet" href="/static/plugins/dataTables/dataTables.bootstrap.css">-->
    <link rel="stylesheet" href="/static/plugins/layer/skin/layer.css">
    <link rel="stylesheet" href="/static/plugins/layer/skin/layer.ext.css">
    <link rel="stylesheet" href="/static/plugins/layer/laydate/need/laydate.css">
    <link rel="stylesheet" href="/static/plugins/layer/laydate/skins/default/laydate.css">
    
    <script src="/static/plugins/jquery-1.12.4/jquery-1.12.4.min.js"></script>
    <script src="/static/plugins/bootstrap-3.3.7/js/bootstrap.min.js"></script>
    <script src="/static/plugins/layer/layer.min.js"></script>
    <script src="/static/plugins/bootstrap-table/bootstrap-table.min.js"></script>
    <script src="/static/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="/static/plugins/layer/laydate/laydate.js"></script>

    <style>
        .text-red{color:red;}
        .text-green{color:#17bb46;}
        .text-orange{color:orange;}
        .text-yellow{color:#c7cd2f;}
        .text-blue{color:#0bb8c8;}
        .fixed-table-toolbar .bars, .fixed-table-toolbar .columns, .fixed-table-toolbar .search{margin-top:-45px;}
        .th-inner{color:#555;}
    </style>
    
<link rel="stylesheet" type="text/css" href="/static/sys/css/common.css" />
<link rel="stylesheet" type="text/css" href="/static/plugins/select2/css/select2.css" />
<link rel="stylesheet" type="text/css" href="/static/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css" />

<link rel="stylesheet" type="text/css" href="/static/sys/css/skin_0.css" />
<style>
    .upfile i{padding-right:3px !important;}
    .file{ position:absolute;right:0;top:0;width:100px;height:100px;opacity:0; ilter:alpha(opacity=0);cursor:pointer;margin-bottom: 0px;margin-right: 0px; }
</style>

</head>

<body class="gray-bg">
    
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <form method="post" id="fmNew" class="form-horizontal" enctype="multipart/form-data">

                        <div class="form-group">
                            <label class="col-sm-2 control-label">请选择微信用户：</label>
                            <div class="col-sm-8">
                                <select class="form-control" name="open_id" id="open_id" onchange="appletValue()">
                                    <option value="">请选择小程序...</option>
                                    <?php if(is_array($applet_list) || $applet_list instanceof \think\Collection || $applet_list instanceof \think\Paginator): $i = 0; $__LIST__ = $applet_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                                    <option value="<?php echo $v['openid']; ?>" applet_id="<?php echo $v['applet_id']; ?>"  nick_name="<?php echo $v['nick_name']; ?>" avatar_url="<?php echo $v['avatar_url']; ?>" <?php if(($v['openid']==$Rs['open_id'])): ?> selected <?php endif; ?>><?php echo $v['openid']; ?></option>
                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">小程序ID：</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" name="applet_id" id="applet_id" readonly value="<?php echo $Rs['applet_id']; ?>">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">昵称：</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" name="nick_name" id="nick_name"  value="<?php echo $Rs['nick_name']; ?>">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">用户头像：</label>

                            <div class="col-sm-1">
                                <span class="btn btn-primary btn-sm" style="margin-bottom:0;padding:6px 8px;" onclick="avatarImg()">
                                    <i class="glyphicon glyphicon-folder-open" style="padding-right:3px;"></i> 用户头像<input type="hidden" name="avatar_url" id="avatar_url" value="<?php echo $Rs['avatar_url']; ?>"/>
                                </span>
                            </div>
                            <div class="col-sm-1">
                                <img id="previewImg_avatar" style="height:34px;float: right;" src="<?php echo $Rs['avatar_url']; ?>">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">相册标题：</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" name="title" id="title" value="<?php echo $Rs['title']; ?>">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">相册模板：</label>
                            <div class="col-sm-8">
                                <select class="form-control" name="skin_title" id="skin_title" onchange="skinValue()">
                                    <option value="">请选择相册模板...</option>
                                    <?php if(is_array($skin_list) || $skin_list instanceof \think\Collection || $skin_list instanceof \think\Paginator): $i = 0; $__LIST__ = $skin_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                                    <option value="<?php echo $v['title']; ?>" skin="<?php echo $v['name']; ?>" <?php if(($v['title']==$Rs['skin_title'])): ?> selected <?php endif; ?>><?php echo $v['title']; ?></option>
                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">背景音乐：</label>
                            <div class="col-sm-8">
                                <select class="form-control" name="music_name" id="music_name" onchange="musicValue()">
                                    <option value="">请选择音乐...</option>
                                    <?php if(is_array($music_list) || $music_list instanceof \think\Collection || $music_list instanceof \think\Paginator): $i = 0; $__LIST__ = $music_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                                    <option value="<?php echo $v['title']; ?>" music_id="<?php echo $v['id']; ?>" music_url="<?php echo $v['mp3_url']; ?>" <?php if(($v['title'] == $Rs['music_name'])): ?> selected <?php endif; ?>><?php echo $v['title']; ?></option>
                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">点击数：</label>
                            <div class="col-sm-8">
                                <input type="number" class="form-control" name="click_num" value="<?php echo $Rs['click_num']; ?>" placeholder="请输入点击数">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">分享数：</label>
                            <div class="col-sm-8">
                                <input type="number" class="form-control" name="share_num" value="<?php echo $Rs['share_num']; ?>" placeholder="请输入分享数">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">封面图：</label>

                            <div class="col-sm-1">
                                <span class="btn btn-primary btn-sm" style="margin-bottom:0;padding:6px 8px;" onclick="thumbImg()">
                                    <i class="glyphicon glyphicon-folder-open" style="padding-right:3px;"></i> 相册封面图<input type="hidden" name="thumb" id="thumb" value="<?php echo $Rs['thumb']; ?>"/>
                                </span>
                            </div>
                            <div class="col-sm-1">
                                <img id="previewImg_thumb" style="height:34px;float: right;" src="<?php echo $Rs['thumb']; ?>">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">审核状态：</label>
                            <div class="col-sm-8">
                                <select class="form-control" name="is_verify">
                                    <?php if(is_array($is_verify_list) || $is_verify_list instanceof \think\Collection || $is_verify_list instanceof \think\Paginator): $i = 0; $__LIST__ = $is_verify_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                                    <option value="<?php echo $key; ?>" <?php if(($key == $Rs['is_verify'])): ?> selected <?php endif; ?>><?php echo $v; ?></option>
                                    <?php endforeach; endif; else: echo "" ;endif; ?>
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">排序：</label>
                            <div class="col-sm-8">
                                <input type="number" class="form-control" name="sort" value="<?php echo $Rs['sort']; ?>" placeholder="越小越靠前">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">分享标题：</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" name="share_title" value="<?php echo $Rs['share_title']; ?>" placeholder="分享标题">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">分享封面图：</label>

                            <div class="col-sm-1">
                                <span class="btn btn-primary btn-sm" style="margin-bottom:0;padding:6px 8px;" onclick="shareImgUrl()">
                                    <i class="glyphicon glyphicon-folder-open" style="padding-right:3px;"></i> 分享封面图<input type="hidden" name="share_img_url" id="share_img_url" value="<?php echo $Rs['share_img_url']; ?>" />
                                </span>
                            </div>
                            <div class="col-sm-1">
                                <img id="previewImg_share" style="height:34px;float: right;" src="<?php echo $Rs['share_img_url']; ?>">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">相册图片：</label>
                            <div class="col-sm-8">
                                <button type="button" class="btn btn-success" onclick="add_line()">新增一行</button>
                            </div>
                        </div>
                        <div class="form-group">
                            <fieldset style="border: 2px solid orange; margin-left: 10%; margin-right: 15%;">
                                <div class="col-sm-10" style="margin-left: 5%;">
                                    <table class="table table-hover" id="tb_album_img" >
                                        <?php if(is_array($album_img_list) || $album_img_list instanceof \think\Collection || $album_img_list instanceof \think\Paginator): $i = 0; $__LIST__ = $album_img_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$album_img): $mod = ($i % 2 );++$i;?>
                                        <tr id="album_img_<?php echo $key+1; ?>">
                                            <td>
                                                <label class="control-label x85">相册图片：</label>
                                            </td>
                                            <td>
                                                <span class="btn btn-primary btn-sm" style="margin-bottom:0;padding:6px 8px;" onclick="albumImg(this)">
                                                    <i class="glyphicon glyphicon-folder-open" style="padding-right:3px;"></i> 相册图片<input type="hidden" name="album_img[img_url][]" class='album_img' value="<?php echo $album_img['img_url']; ?>" />
                                                </span>
                                                <div class="col-sm-1">
                                                    <img class="previewImg_album" style="height:34px;float: right;" src="<?php echo $album_img['img_url']; ?>" >
                                                </div>
                                            </td>

                                            <td><label class='control-label x85'>内容:</label></td>
                                            <td><input type='text'  name='album_img[desc][]' value="<?php echo $album_img['desc']; ?>" /></td>
                                            <td><label class='control-label x85'>排序:</label></td>
                                            <td><input type='number' name='album_img[sort][]' value="<?php echo $album_img['sort']; ?>"></td>
                                            <td><button type="button" class="btn btn-warning" onclick="$(this).parent().parent().remove()">删除</button></td>
                                        </tr>
                                        <?php endforeach; endif; else: echo "" ;endif; ?>

                                    </table>
                                </div>
                            </fieldset>
                        </div>

                        <div id = 'hidden_input'>
                            <input type="hidden" id="music_id" name="music_id" value="<?php echo $Rs['music_id']; ?>" />
                            <input type="hidden" id="music_url" name="music_url" value="<?php echo $Rs['music_url']; ?>"/>
                            <input type="hidden" id="is_show" name="is_show" value="<?php echo $Rs['is_show']; ?>"/>
                            <input type="hidden"  name="is_system" value="<?php echo $Rs['is_system']; ?>"/>
                            <input type="hidden"  name="skin" id = "skin" value="<?php echo $Rs['skin']; ?>"/>
                            <input type="hidden"  name="id" value="<?php echo $Rs['id']; ?>"/>
                        </div>

                        <div id="dg" style="z-index: 9999; position: fixed ! important; right: 50%; top:90%;">
                            <div class="form-group">
                                <div class="col-sm-12 col-sm-offset-5" >
                                    <button class="btn btn-primary" id="ok" type="button">提交</button>
                                    <button class="btn btn-white" id="cancel" type="button">取消</button>
                                </div>
                            </div>
                        </div>

                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

</body>
    
<script type="text/javascript" src="/static/plugins/select2/js/select2.js"></script>
<script type="text/javascript" src="/static/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="/static/plugins/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>

<script>
    $(document).ready(function () {
        $("#ok").bind("click", Save);
        $("#cancel").bind("click", function () {
            parent.layer.close(parent.layer_edit_index);
        });

        /**
         * 保存内容
         */
        function Save() {
            var load_index = layer.load(0, { shade: false });

            $.ajax({
                type: 'POST',
                url: "<?php echo url('album/edit'); ?>",
                data: $("#fmNew").serialize(),
                dataType: 'json',
                success: function (data) {
                    if (data.code == 1) {
                        layer.close(load_index);
                        layer.alert(data.msg, function () {
                            parent.refreshtb();
                            //window.close();
                            parent.layer.close(parent.layer_edit_index);
                        });
                    } else {
                        layer.alert(data.msg);
                    }
                }
            })
        }

        $('#skin_title').select2();
        $('#open_id').select2();
        $('#music_name').select2();
    });

    /**
     * 新增图片
     */
    var layer_image_add;
    function thumbImg() {
        layer_image_add = layer.open({
            type: 2,
            title: "新增图片",
            area: ['70%', '90%'],
            content: "<?php echo url('upload/image'); ?>?tag=thumb_img"
        })
    }
    function shareImgUrl() {
        layer_image_add = layer.open({
            type: 2,
            title: "新增图片",
            area: ['70%', '90%'],
            content: "<?php echo url('upload/image'); ?>?tag=share_img"
        })
    }

    function avatarImg() {
        layer_image_add = layer.open({
            type: 2,
            title: "新增图片",
            area: ['70%', '90%'],
            content: "<?php echo url('upload/image'); ?>?tag=avatar_img"
        })
    }

    function albumImg(obj) {
        var tag = $(obj).parent().parent('tr').attr('id');
        layer_image_add = layer.open({
            type: 2,
            title: "新增图片",
            area: ['70%', '90%'],
            content: "<?php echo url('upload/image'); ?>?tag=" + tag
        })
    }

    // 上传成功后的回调，该函数名不能写错
    function getImageUrl(res) {
        if (res.tag == 'thumb_img') {
            $('#thumb').val(res.url);
            $('#previewImg_thumb').attr('src', res.url);
        } else if (res.tag == 'share_img') {
            $('#share_img_url').val(res.url);
            $('#previewImg_share').attr('src', res.url);
        } else if (res.tag == 'avatar_img') {
            $('#avatar_url').val(res.url);
            $('#previewImg_avatar').attr('src', res.url);
        } else {
            var id = '#' + res.tag;
            $(id).find('.album_img').val(res.url);
            $(id).find('.previewImg_album').attr('src', res.url);
        }
    }

    function appletValue() {
        var applet_id = $("#open_id").children('option:selected').attr('applet_id');
        var nick_name = $("#open_id").children('option:selected').attr('nick_name');
        var avatar_url = $("#open_id").children('option:selected').attr('avatar_url');

        $('#applet_id').val(applet_id);
        $('#nick_name').val(nick_name);
        $('#avatar_url').val(avatar_url);
    }

    function musicValue() {
        var music_id = $("#music_name").children('option:selected').attr('music_id');
        var music_url = $("#music_url").children('option:selected').attr('music_url');
        $('#music_id').val(music_id);
        $('#music_url').val(music_url);
    }

    function skinValue() {
        var skin_name = $("#skin_title").children('option:selected').attr('skin');
        $('#skin').val(skin_name);
    }

    // 照片增加
    function add_line(){
        var tr = $('#tb_album_img').find('tr:last');
        if (tr.size() > 0) {
            last_id = tr.attr('id').split('album_img_', 2);
            last_id_index = last_id[1];
            next_last_id = 'album_img_'+(Number(last_id_index)+1);
        } else {
            next_last_id = 'album_img_1';
        }
        $html = "<tr id='"+ next_last_id +"'><td><label class='control-label x85'>相册图片：</label></td>" +
            "<td><span class='btn btn-primary btn-sm' style='margin-bottom:0;padding:6px 8px;' onclick='albumImg(this)'>" +
            "<i class='glyphicon glyphicon-folder-open' style='padding-right:3px;'></i> 相册封面图<input type='hidden' name='album_img[img_url][]' class='album_img' /></span>" +
            "<div class='col-sm-1'><img class='previewImg_album' style='height:34px;float: right;'></div></td>"+
            "<td><label class='control-label x85'>内容:</label></td><td><input type='text' name='album_img[desc][]' /></td>"+
            "<td><label class='control-label x85'>排序:</label></td><td><input type='number' value='1' name='album_img[sort][]'></td>"+
            "<td><button type='button' class='btn btn-warning' onclick='$(this).parent().parent().remove()'>删除</button></td></tr>";
        $('#tb_album_img').append($html);
    }

</script>

<!-- Mirrored from www.zi-han.net/theme/hplus/ by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:17:11 GMT -->
</html>
